<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>尺寸选择</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<script type="text/javascript">
	function showsizediv() {
		document.getElementById("sizeChooseDiv").style.display = "block";
		document.getElementById("DetailDivbody").style.display = "none";
		document.getElementById("NextDiv").style.display = "none";

	}
	function closesizediv() {
		document.getElementById("sizeChooseDiv").style.display = "none";
		document.getElementById("DetailDivbody").style.display = "block";
		document.getElementById("NextDiv").style.display = "block";
	}
	function checksize() {
		var styleredio = document.getElementsByName("checkbox");
		var checksize = "";
		for ( var i = 0; i < styleredio.length; i++) {
			if (styleredio[i].checked == true) {
				var checksize = checksize + "_" + styleredio[i].value;
				document.getElementById("checksize").value = checksize;
			}
		}
	}
	function Add(){
		var checkindex="";
		var styleredio = document.getElementsByName("checkbox");
		var div =document.getElementById("DetailDiv");
		var divbody=document.getElementById("DetailDivbody");
		
		for ( var i = 0; i < styleredio.length; i++) {
			if (styleredio[i].checked == true) {
				checkindex=checkindex+"_"+i;
				
				var checksize =styleredio[i].value;	
				 var span=	document.createElement("span");		
                 span.id="span_"+checksize;
				   var countTxt = document.createTextNode("尺寸：");
				   var inputTxt = document.createElement("input");
				   inputTxt.type = "text";
				   inputTxt.name = "size_"+checksize;
				   inputTxt.id="size_"+checksize;
				   inputTxt.value=checksize;
				   var numTxt = document.createTextNode("数量：");
				   var numinputTxt = document.createElement("input");
					var br = document.createElement("br");
				   numinputTxt.type = "text";
				   numinputTxt.name = "num_"+checksize;
				   numinputTxt.id="num_"+checksize;
				   numinputTxt.size=10;
				   numinputTxt.value=1;
				   var btn = document.createElement("input");
				   btn.type = "button";
				   btn.id=checksize;
				   btn.value = "删除";
				   btn.onclick = function(){
					   var obj=document.getElementById("span_"+this.id);
				       div.removeChild(obj);
				     
				   }
				   document.getElementById("checkindex").value=checkindex;
				   div.appendChild(span)
				   span.appendChild(countTxt);
				   span.appendChild(inputTxt);
				   span.appendChild(numTxt);
				   span.appendChild(numinputTxt);
				   span.appendChild(btn);
				   div.appendChild(br);
				   
			}
		}
		document.getElementById("sizeChooseDiv").style.display = "none";
		document.getElementById("DetailDivbody").style.display = "block";
		document.getElementById("NextDiv").style.display = "block";
	}
		function getdate()
		{
			var checksize="";
			var sizenum="";
			
		 var list=document.getElementById("DetailDiv").getElementsByTagName("input");

		 for(var i=0;i<list.length;i++)
		 {
		       //判断是否为文本框
		       if(list[i].type=="text")   
		       {
		    	   if(list[i].id.substr(0,list[i].id.indexOf("_"))=="size"){
		    		   checksize=checksize+list[i].value+"_";
		    	   }else if(list[i].id.substr(0,list[i].id.indexOf("_"))=="num"){
		    		   sizenum=sizenum+list[i].value+"_";
		    	   }
		       }
		                 
		       
		 }
		 document.getElementById("checksize").value = checksize;
		 document.getElementById("sizenum").value = sizenum;
		}
		
		function sizesubmit(){
			getdate();
			var checksize= document.getElementById("checksize").value;
			var sizenum= document.getElementById("sizenum").value;
			var checkindex=document.getElementById("checkindex").value;
			if(checksize!=''&&sizenum!=''){
				document.getElementById("form1").submit();
			}else{
				alert("请选择尺寸!");
			}
		}
		function init() {
			
			var div =document.getElementById("DetailDiv");
			var sizenum='<%=session.getAttribute("sizenum")%>';
			var checksize='<%=session.getAttribute("checksize")%>';
			var checkindex='<%=session.getAttribute("checkindex")%>';
		var divbody = document.getElementById("DetailDivbody");
		var checkindexstrs = new Array();
		var styleredio = document.getElementsByName("checkbox");

		checkindexstrs = checkindex.split("_");
		for (i = 0; i < checkindexstrs.length; i++) {
			checkindexstrs[i].checked == true;
		}

		checksizestrs = checksize.split("_");
		sizenumstrs = sizenum.split("_");
		if (checksizestrs.length > 0) {
			for (i = 0; i < checksizestrs.length; i++) {
				var checksize = checksizestrs[i];
				if (checksize != '') {
					if (checksize != 'null') {
						if (checksize != undefined) {
							var span = document.createElement("span");
							span.id = "span_" + checksize;
							var countTxt = document.createTextNode("尺寸：");
							var inputTxt = document.createElement("input");
							var br = document.createElement("br");
							inputTxt.type = "text";
							inputTxt.name = "size_" + checksize;
							inputTxt.id = "size_" + checksize;
							inputTxt.value = checksize;
							var numTxt = document.createTextNode("数量：");
							var numinputTxt = document.createElement("input");
							numinputTxt.type = "text";
							numinputTxt.name = "num_" + checksize;
							numinputTxt.id = "num_" + checksize;
							numinputTxt.size = 10;
							numinputTxt.value = sizenumstrs[i];
							var btn = document.createElement("input");
							btn.type = "button";
							 btn.id=checksize;
							btn.value = "删除";
							btn.onclick = function() {
								 var obj=document.getElementById("span_"+this.id);
								div.removeChild(obj);
								
							}
							document.getElementById("checkindex").value = checkindex;
							div.appendChild(span)
							span.appendChild(countTxt);
							span.appendChild(inputTxt);
							span.appendChild(numTxt);
							span.appendChild(numinputTxt);
							span.appendChild(btn);
							div.appendChild(br);
						}
					}
				}
			}
		}

	}
</script>
</head>
<body background="../images/bg/bg.jpg" onload="init()">
	<div class="TitleDiv">
		<font class="TitleCharFont">我要买</font>

	</div>
	<div class="TitleDiv">
		<br /> <span align="center" style="width: 50%"> <span>
				<a href="../view/StyleMan.jsp"
				style="cursor: hand; cursor: pointer;"><input
					name="styleChooseButton" type="button" class="TitleNoSelectButton"
					id="styleChooseButton" value="款式选择" /></a>
		</span> <span> <a href="../view/SizeChoose.jsp"
				style="cursor: hand; cursor: pointer;"><input
					name="sizeChooseButton" type="button" class="TitleSelectButton"
					id="sizeChooseButton" value="尺寸选择" /></a>
		</span> <span> <a href="../view/Lining.jsp"
				style="cursor: hand; cursor: pointer;"><input
					name="liningChooseButton" type="button" class="TitleNoSelectButton"
					id="liningChooseButton" value="面料选择" /></a>
		</span> <span> <a href="../view/AccessoryChoose.jsp"
				style="cursor: hand; cursor: pointer;"><input
					name="accessoryChooseButton" type="button"
					class="TitleNoSelectButton" id="accessoryChooseButton" value="辅料选择" /></a>
		</span> <span><a href="../view/PriceSheet.jsp"
				style="cursor: hand; cursor: pointer;"><input
					name="priceSheetButton" type="button" class="TitleNoSelectButton"
					id="priceSheetButton" value="报价单" /> </a> </span>
		</span>
	</div>

	<div id="sizeChooseDiv" name="sizeChooseDiv"
		style="background: #FFFFCC; display: none; width: 700px; margin-left: 23%; margin-top: 10px; z-index: 100"
		align="center">
		<span style="margin-right: 0px; width: 30px;"> <input
			type="button" onclick="Add()" value="确定" /> &nbsp;&nbsp;&nbsp;<input
			type="button" onclick="closesizediv()" value="关闭" />

		</span>
		<table width="639" border="0">
			<tr height="18">
				<td width="76" rowspan="8"><div align="center">A型   </div></td>
				<td width="76" height="22"><div align="center">大小</div></td>
				<td width="71"><div align="center">前衣长</div></td>
				<td width="55"><div align="center">后衣长</div></td>
				<td width="61"><div align="center">胸围</div></td>
				<td width="55"><div align="center">腰围</div></td>
				<td width="65"><div align="center">下摆</div></td>
				<td width="57"><div align="center">肩宽</div></td>
				<td width="44"><div align="center">袖长</div></td>
			</tr>
			<tr height="19">
				<td height="19"><div align="left">160/80A</div></td>
				<td><div align="left">73</div></td>
				<td><div align="left">70</div></td>
				<td><div align="left">97</div></td>
				<td><div align="left">86</div></td>
				<td><div align="left">102</div></td>
				<td><div align="left">42.2</div></td>
				<td><div align="left">57.5</div></td>
				<td><input type="checkbox" name="checkbox" value="160/80A" />
				</td>
			</tr>
			<tr height="19">
				<td height="19"><div align="left">165/84A</div></td>
				<td><div align="left">75</div></td>
				<td><div align="left">72</div></td>
				<td><div align="left">101</div></td>
				<td><div align="left">90</div></td>
				<td><div align="left">106</div></td>
				<td><div align="left">43.6</div></td>
				<td><div align="left">59</div></td>
				<td><input type="checkbox" name="checkbox" value="165/84A" />
				</td>
			</tr>
			<tr height="19">
				<td height="19"><div align="left">170/88A</div></td>
				<td><div align="left">77</div></td>
				<td><div align="left">74</div></td>
				<td><div align="left">105</div></td>
				<td><div align="left">94</div></td>
				<td><div align="left">110</div></td>
				<td><div align="left">45</div></td>
				<td><div align="left">60.5</div></td>
				<td><input type="checkbox" name="checkbox" value="170/88A" />
				</td>
			</tr>
			<tr height="19">
				<td height="26"><div align="left">175/92A</div></td>
				<td><div align="left">79</div></td>
				<td><div align="left">76</div></td>
				<td><div align="left">109</div></td>
				<td><div align="left">98</div></td>
				<td><div align="left">114</div></td>
				<td><div align="left">46.4</div></td>
				<td><div align="left">62</div></td>
				<td><input type="checkbox" name="checkbox" value="175/92A" />
				</td>
			</tr>
			<tr height="19">
				<td height="19"><div align="left">180/96A</div></td>
				<td><div align="left">81</div></td>
				<td><div align="left">78</div></td>
				<td><div align="left">113</div></td>
				<td><div align="left">102</div></td>
				<td><div align="left">118</div></td>
				<td><div align="left">47.8</div></td>
				<td><div align="left">63.5</div></td>
				<td><input type="checkbox" name="checkbox" value="180/96A" />
				</td>
			</tr>
			<tr height="19">
				<td height="19"><div align="left">185/100A</div></td>
				<td><div align="left">83</div></td>
				<td><div align="left">80</div></td>
				<td><div align="left">117</div></td>
				<td><div align="left">106</div></td>
				<td><div align="left">122</div></td>
				<td><div align="left">49.2</div></td>
				<td><div align="left">65</div></td>
				<td><input type="checkbox" name="checkbox" value="185/100A" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">190/104A</td>
				<td>85</td>
				<td>82</td>
				<td>121</td>
				<td>110</td>
				<td>126</td>
				<td>50.6</td>
				<td>66.5</td>
				<td><input type="checkbox" name="checkbox" value="190/104A" />
				</td>
			</tr>

		</table>
		<p>&nbsp;</p>
		<table width="639" border="0">
			<tr height="18">
				<td width="76" rowspan="8">B型</td>
				<td width="81" height="25">大小</td>
				<td width="72">前衣长</td>
				<td width="55">后衣长</td>
				<td width="61">胸围</td>
				<td width="63">腰围</td>
				<td width="65">下摆</td>
				<td width="58">肩宽</td>
				<td width="50">袖长</td>
			</tr>
			<tr height="19">
				<td height="19">160/84B</td>
				<td>73</td>
				<td>70</td>
				<td>101</td>
				<td>91</td>
				<td>107</td>
				<td>43.6</td>
				<td>57.5</td>
				<td><input type="checkbox" name="checkbox" value="160/84B" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">165/88B</td>
				<td>75</td>
				<td>72</td>
				<td>105</td>
				<td>95</td>
				<td>111</td>
				<td>45</td>
				<td>59</td>
				<td><input type="checkbox" name="checkbox" value="165/88B" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">170/92B</td>
				<td>77</td>
				<td>74</td>
				<td>109</td>
				<td>99</td>
				<td>115</td>
				<td>46.4</td>
				<td>60.5</td>
				<td><input type="checkbox" name="checkbox" value="170/92B" />
				</td>
			</tr>
			<tr height="19">
				<td height="22">175/96B</td>
				<td>79</td>
				<td>76</td>
				<td>113</td>
				<td>103</td>
				<td>119</td>
				<td>47.8</td>
				<td>62</td>
				<td><input type="checkbox" name="checkbox" value="175/96B" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">180/100B</td>
				<td>81</td>
				<td>78</td>
				<td>117</td>
				<td>107</td>
				<td>123</td>
				<td>49.2</td>
				<td>63.5</td>
				<td><input type="checkbox" name="checkbox" value="180/100B" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">185/104B</td>
				<td>83</td>
				<td>80</td>
				<td>121</td>
				<td>111</td>
				<td>127</td>
				<td>50.6</td>
				<td>65</td>
				<td><input type="checkbox" name="checkbox" value="185/104B" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">190/108B</td>
				<td>85</td>
				<td>82</td>
				<td>125</td>
				<td>115</td>
				<td>131</td>
				<td>52</td>
				<td>66.5</td>
				<td><input type="checkbox" name="checkbox" value="190/108B" />
				</td>
			</tr>
		</table>

		<p>&nbsp;</p>
		<table width="639" border="0">
			<tr height="19">
				<td width="78" height="152" rowspan="8">C型   </td>
				<td width="78">大小</td>
				<td width="72">前衣长</td>
				<td width="57">后衣长</td>
				<td width="64">胸围</td>
				<td width="62">腰围</td>
				<td width="61">下摆</td>
				<td width="58">肩宽</td>
				<td width="51">袖长</td>
			</tr>
			<tr height="19">
				<td height="19">160/88C</td>
				<td>73</td>
				<td>70</td>
				<td>105</td>
				<td>96</td>
				<td>111</td>
				<td>45</td>
				<td>57.5</td>
				<td><input type="checkbox" name="checkbox" value="160/88C" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">165/92C</td>
				<td>75</td>
				<td>72</td>
				<td>109</td>
				<td>100</td>
				<td>115</td>
				<td>46.4</td>
				<td>59</td>
				<td><input type="checkbox" name="checkbox" value="165/92C" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">170/96C</td>
				<td>77</td>
				<td>74</td>
				<td>113</td>
				<td>104</td>
				<td>119</td>
				<td>47.8</td>
				<td>60.5</td>
				<td><input type="checkbox" name="checkbox" value="170/96C" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">175/100C</td>
				<td>79</td>
				<td>76</td>
				<td>117</td>
				<td>108</td>
				<td>123</td>
				<td>49.2</td>
				<td>62</td>
				<td><input type="checkbox" name="checkbox" value="175/100C" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">180/104C</td>
				<td>81</td>
				<td>78</td>
				<td>121</td>
				<td>112</td>
				<td>127</td>
				<td>50.6</td>
				<td>63.5</td>
				<td><input type="checkbox" name="checkbox" value="180/104C" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">185/108C</td>
				<td>83</td>
				<td>80</td>
				<td>125</td>
				<td>116</td>
				<td>131</td>
				<td>52</td>
				<td>65</td>
				<td><input type="checkbox" name="checkbox" value="185/108C" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">190/112C</td>
				<td>85</td>
				<td>82</td>
				<td>129</td>
				<td>120</td>
				<td>135</td>
				<td>53.4</td>
				<td>66.5</td>
				<td><input type="checkbox" name="checkbox" value="190/112C" />
				</td>
			</tr>
		</table>

		<p>&nbsp;</p>
		<table width="639" border="0">
			<tr height="19">
				<td width="81" height="152" rowspan="8">D型   </td>
				<td width="69">大小</td>
				<td width="81">前衣长</td>
				<td width="53">后衣长</td>
				<td width="67">胸围</td>
				<td width="59">腰围</td>
				<td width="62">下摆</td>
				<td width="58">肩宽</td>
				<td width="51">袖长</td>
			</tr>
			<tr height="19">
				<td height="19">160/92D</td>
				<td>73</td>
				<td>70</td>
				<td>109</td>
				<td>101</td>
				<td>115</td>
				<td>46.4</td>
				<td>57.5</td>
				<td><input type="checkbox" name="checkbox" value="160/92D" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">165/96D</td>
				<td>75</td>
				<td>72</td>
				<td>113</td>
				<td>105</td>
				<td>119</td>
				<td>47.8</td>
				<td>59</td>
				<td><input type="checkbox" name="checkbox" value="165/96D" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">170/100D</td>
				<td>77</td>
				<td>74</td>
				<td>117</td>
				<td>109</td>
				<td>123</td>
				<td>49.2</td>
				<td>60.5</td>
				<td><input type="checkbox" name="checkbox" value="170/100D" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">175/104D</td>
				<td>79</td>
				<td>76</td>
				<td>121</td>
				<td>113</td>
				<td>127</td>
				<td>50.6</td>
				<td>62</td>
				<td><input type="checkbox" name="checkbox" value="175/104D" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">180/108D</td>
				<td>81</td>
				<td>78</td>
				<td>125</td>
				<td>117</td>
				<td>131</td>
				<td>52</td>
				<td>63.5</td>
				<td><input type="checkbox" name="checkbox" value="180/108D" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">185/112D</td>
				<td>83</td>
				<td>80</td>
				<td>129</td>
				<td>121</td>
				<td>135</td>
				<td>53.4</td>
				<td>65</td>
				<td><input type="checkbox" name="checkbox" value="185/112D" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">190/116D</td>
				<td>85</td>
				<td>82</td>
				<td>133</td>
				<td>125</td>
				<td>139</td>
				<td>54.8</td>
				<td>66.5</td>
				<td><input type="checkbox" name="checkbox" value="190/116D" />
				</td>
			</tr>
		</table>




		<p>&nbsp;</p>
		<table width="639" border="0">
			<tr height="19">
				<td width="76" height="152" rowspan="8">E型   </td>
				<td width="68">大小</td>
				<td width="77">前衣长</td>
				<td width="60">后衣长</td>
				<td width="49">胸围</td>
				<td width="57">腰围</td>
				<td width="58">下摆</td>
				<td width="53">肩宽</td>
				<td width="54">袖长</td>
			</tr>
			<tr height="19">
				<td height="19">160/96E</td>
				<td>73</td>
				<td>70</td>
				<td>113</td>
				<td>106</td>
				<td>119</td>
				<td>47.8</td>
				<td>57.5</td>
				<td width="23"><input type="checkbox" name="checkbox"
					value="160/96E" /></td>
			</tr>
			<tr height="19">
				<td height="19">165/100E</td>
				<td>75</td>
				<td>72</td>
				<td>117</td>
				<td>110</td>
				<td>123</td>
				<td>49.2</td>
				<td>59</td>
				<td><input type="checkbox" name="checkbox" value="165/100E" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">170/104E</td>
				<td>77</td>
				<td>74</td>
				<td>121</td>
				<td>114</td>
				<td>127</td>
				<td>50.6</td>
				<td>60.5</td>
				<td><input type="checkbox" name="checkbox" value="170/104E" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">175/108E</td>
				<td>79</td>
				<td>76</td>
				<td>125</td>
				<td>118</td>
				<td>131</td>
				<td>52</td>
				<td>62</td>
				<td><input type="checkbox" name="checkbox" value="175/108E" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">180/112E</td>
				<td>81</td>
				<td>78</td>
				<td>129</td>
				<td>122</td>
				<td>135</td>
				<td>53.4</td>
				<td>63.5</td>
				<td><input type="checkbox" name="checkbox" value="180/112E" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">185/116E</td>
				<td>83</td>
				<td>80</td>
				<td>133</td>
				<td>126</td>
				<td>139</td>
				<td>54.8</td>
				<td>65</td>
				<td><input type="checkbox" name="checkbox" value="185/116E" />
				</td>
			</tr>
			<tr height="19">
				<td height="19">190/120E</td>
				<td>85</td>
				<td>82</td>
				<td>137</td>
				<td>130</td>
				<td>143</td>
				<td>56.2</td>
				<td>66.5</td>
				<td><input type="checkbox" name="checkbox" value="190/120E" />
				</td>
			</tr>
		</table>

	</div>

	<div class="DetailDiv" id="DetailDivbody" name="DetailDivbody">

		<!--	<strong class="StyleChareFont">尺寸：</strong> <input name="size"
				type="text" id="size" /> <strong class="StyleChareFont">数量：</strong>
			<input name="size2" type="text" id="size2" size="10" />  -->
		<strong class="StyleChareFont">请点击“获取尺寸”按钮选择尺寸，可以选择多个尺寸，选择完成后请点击确认按钮。</strong>
		<input name="getSizeButton" type="button" class="SizeButton"
			id="getSizeButton22" value="获取尺寸(可多选)" onclick="showsizediv()" /> <br />
		<div id="DetailDiv" name="DetailDiv""></div>

	</div>
	<form id="form1" name="form1" method="post" action="sizeAction">
		<input type="hidden" name="checksize" id="checksize" value=""></input>
		<input type="hidden" name="sizenum" id="sizenum" value=""></input> <input
			type="hidden" name="checkindex" id="checkindex" value=""></input>
		<div class="NextDiv" id="NextDiv" name="NextDiv">
			<a href="../view/StyleMan.jsp" style="cursor: hand; cursor: pointer;"><input
				name="getSizeButton" type="button" class="NextButton"
				id="getSizeButton" value="上一步" /></a><input name="si" type="button"
				class="NextButton" id="getSizeButton" value="下一步"
				onclick="sizesubmit()" />
		</div>
	</form>

</body>
</html>